home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac: Not for Sale / Another.not.for.sale (Australia).iso / fade into you / getting there / Apps / MOO-1.7.6.src / inc / net_mplex.h < prev    next >
Text File  |  1994-11-02  |  3KB  |  81 lines

  1. /******************************************************************************
  2.   Copyright (c) 1992 Xerox Corporation.  All rights reserved.
  3.   Portions of this code were written by Stephen White, aka ghond.
  4.   Use and copying of this software and preparation of derivative works based
  5.   upon this software are permitted.  Any distribution of this software or
  6.   derivative works must comply with all applicable United States export
  7.   control laws.  This software is made available AS IS, and Xerox Corporation
  8.   makes no warranty about the software, its performance or its conformity to
  9.   any specification.  Any person obtaining a copy of this software is requested
  10.   to send their name and post office or electronic mail address to:
  11.     Pavel Curtis
  12.     Xerox PARC
  13.     3333 Coyote Hill Rd.
  14.     Palo Alto, CA 94304
  15.     Pavel@Xerox.Com
  16.  *****************************************************************************/
  17.  
  18. /* This describes the complete set of procedures that a multiplexing wait
  19.  * implementation must provide.
  20.  *
  21.  * The `mplex' abstraction provides a way to wait until it is possible to
  22.  * perform an I/O operation on any of a set of file descriptors without
  23.  * blocking.  Uses of the abstraction always have the following form:
  24.  *
  25.  *    mplex_clear();
  26.  *    { mplex_add_reader(fd)  or  mplex_add_writer(fd) }*
  27.  *    timed_out = mplex_wait(timeout);
  28.  *    { mplex_is_readable(fd)  or  mplex_is_writable(fd) }*
  29.  *
  30.  * The set of file descriptors maintained by the abstraction is referred to
  31.  * below as the `wait set'.  Each file descriptor in the wait set is marked
  32.  * with the kind of I/O (i.e., reading, writing, or both) desired.
  33.  */
  34.  
  35. #ifndef Net_MPlex_H
  36. #define Net_MPlex_H 1
  37.  
  38. extern void    mplex_clear(void);
  39.                 /* Reset the wait set to be empty. */
  40.  
  41. extern void    mplex_add_reader(int fd);
  42.                 /* Add the given file descriptor to the wait
  43.                  * set, marked for reading.
  44.                  */
  45.  
  46. extern void    mplex_add_writer(int fd);
  47.                 /* Add the given file descriptor to the wait
  48.                  * set, marked for writing.
  49.                  */
  50.  
  51. extern int    mplex_wait(unsigned timeout);
  52.                 /* Wait until it is possible either to do the
  53.                  * appropriate kind of I/O on some descriptor
  54.                  * in the wait set or until `timeout' seconds
  55.                  * have elapsed.  Return true iff the timeout
  56.                  * expired without any I/O becoming possible.
  57.                  */
  58.  
  59. extern int    mplex_is_readable(int fd);
  60.                 /* Return true iff the most recent mplex_wait()
  61.                  * call terminated (in part) because reading
  62.                  * had become possible on the given descriptor.
  63.                  */
  64.  
  65. extern int    mplex_is_writable(int fd);
  66.                 /* Return true iff the most recent mplex_wait()
  67.                  * call terminated (in part) because reading
  68.                  * had become possible on the given descriptor.
  69.                  */
  70.  
  71. #endif /* !Net_MPlex_H */
  72.  
  73. /* $Log: net_mplex.h,v $
  74.  * Revision 1.2  1992/10/23  23:03:47  pavel
  75.  * Added copyright notice.
  76.  *
  77.  * Revision 1.1  1992/09/23  17:14:17  pavel
  78.  * Initial RCS-controlled version.
  79.  *
  80.  */
  81.